<template>
  <ElDrawer v-model="visible" direction="ttb" size="80%" :model="purchaseBill">
    <ElForm ref="form" label-width="auto">
      <ElRow>
        <ElCol :span="10">
          <ElFormItem label="供货商" prop="supplier">
            <ElInput v-model="purchaseBill.supplier"></ElInput>
          </ElFormItem>
        </ElCol>
      </ElRow>
      <ElRow>
        <ElCol :span="8">
          <ElFormItem label="订货日期" prop="orderDate">
            <ElDatePicker v-model="purchaseBill.orderDate"></ElDatePicker>
          </ElFormItem>
        </ElCol>
        <ElCol :span="8" :offset="8">
          <ElFormItem label="交货日期" prop="receiveDate">
            <ElDatePicker v-model="purchaseBill.receiveDate"></ElDatePicker>
          </ElFormItem>
        </ElCol>
      </ElRow>

      <ElDivider>detail</ElDivider>
            <ElTable ref="table" :data="purchaseBill.items" @selection-change="(rows:any) => selected=rows">
              <ElTableColumn type="selection" width="64" />
              <ElTableColumn label="" prop=""></ElTableColumn>
              <ElTableColumn label="" prop=""></ElTableColumn>
              <ElTableColumn label="单价" prop=""></ElTableColumn>
              <ElTableColumn label="数量" prop=""></ElTableColumn>
            </ElTable>

      <ElDivider>operator</ElDivider>
      <ElDescriptions>
        <ElDescriptionsItem label="审核人"></ElDescriptionsItem>
        <!-- <ElDescriptionsItem label="经办人">{{ account.nickname }}</ElDescriptionsItem> -->
        <ElDescriptionsItem label="经办人">{{ account.nickname }}</ElDescriptionsItem>
      </ElDescriptions>
    </ElForm>
  </ElDrawer>
</template>
<script lang="ts">
import type { PurchaseBill, PurchaseItem } from '@/entity/purchase.entity'
import { accountStore } from '@/stores/account'
/**
 * 页面核心数据结构体说明文档
 *
 *
 */
// import from

export default defineComponent({
  name: 'PurchaseInsert',
  props: {
    sampleP: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      sampleD: 'value',
      visible: false,
      purchaseBill: {
        supplier: 'tesla实验室-SC009',
        orderDate: null,
        receiveDate: null,
        items: [
          {
            goodsCode: '',
            goodsName: '',
            price: 0,
            quantity: 0,
            itemId: 0,
            billFk: '',
            priority: 0
          }
        ] as Array<PurchaseItem>,

        billId: '',
        billState: 'toSubmit',
        amount: 0,
        nextItemId: 0,
        applier: '',
        applyTime: null,
        auditor: '',
        auditTime: null,
        auditMsg: '',
        history: '',
        updateTime: null
      } as PurchaseBill,
      selected:[] as Array<PurchaseItem>,
        items:[

        ]
    }
  },
  computed: {
    ...mapState(accountStore, ['account'])
    /* sampleC() {
      return this.sampleD + "--";
    }, */
  },
  created() {},
  mounted() {},
  methods: {
    // sampleM() {},
    show() {
      this.visible = true
    }
  },
  watch: {
    // sampleP(n, o) {},
  }
})
</script>

<!--<style scoped>-->
<style lang="scss" scoped>
.el-form {
  width: 1000px;
  margin-left: 160px;
}
</style>
